package TCP;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class Dictionary extends Server {
    Map<String,String>map=new HashMap<>();
    public Dictionary(int port) throws IOException {
        super(port);
        map.put("hello","你好");
        map.put("poison","毒药");
        map.put("person","人");
    }

    @Override
    public void start() throws IOException {
        System.out.println("Dictionary is Running...");
        super.start();
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request,"IsNotFound");
    }

    public static void main(String[] args) throws IOException {
    Dictionary dictionary=new Dictionary(9090);
    dictionary.start();
    }
}
